package ebj.common.annotation.demo_data_provider_manager.mocker;

import java.util.Map;

import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Functions;
import com.google.common.collect.Maps;

public class AppRuntimeDataMocker {
    public static Map<String, String> getDatasourceConfig() {
        Map<String, String> datasourceInfo = Maps.newHashMap();
        String mock_data = "{\"driver\": \"com.mysql.jdbc.Driver\",\"datasource\": \"mysql\",\"host\": \"localhost\",\"port\": \"3306\",\"database\": \"adhoc\",\"user\": \"adhoc\",\"password\": \"123456\"}";
        JSONObject config = JSONObject.parseObject(mock_data);
        datasourceInfo = Maps.transformValues(config, Functions.toStringFunction());
        return datasourceInfo;
    }
    public static Map<String, String> getQuery() {
        Map<String, String> query = Maps.newHashMap();
        String query_str = "{\"query\":{\"sql\":\"SELECT * FROM adhoc_query_history;\"}}";
        JSONObject queryObject = JSONObject.parseObject(query_str);
        query = Maps.transformValues(queryObject.getJSONObject("query"), Functions.toStringFunction());
        return query;
    }
    
    public static Map<String, String> getDemoDatasourceConfig() {
        Map<String, String> datasourceInfo = Maps.newHashMap();
        datasourceInfo.put("param", "Mock DatasourceConfig for DataProvider demo");
        return datasourceInfo;
    }
    public static Map<String, String> getDemoQuery() {
        Map<String, String> query = Maps.newHashMap();
        query.put("queryParam", "1");
        return query;
    }
}
